<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    let arr = ["北京", "上海", "广州", "深圳"]

    //循环数组
    for(item of arr){
      console.log(item)
    }

    //循环字符串
    let str = "北京上海广州深圳";
    for (item of str) {
      console.log(item)
    }


    let entry=Object.entries(arr)
    //打印格式
    console.log(entry)
    // 自动循环
    entry.forEach(item=>{
      console.log(item[0],item[1])
    })

    //手动循环
    for([index,item] of entry){
      console.log(index,item)
    }
  </script>
</head>

<body>

</body>

</html>